package gt.actions;

import gt.service.UserService;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet("/alterGrade")
public class alterGrade extends HttpServlet {

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		    String id= (String)req.getParameter("id");
		    String grade= (String)req.getParameter("grade");
		    System.out.println(id+""+grade+"pp");
		    UserService userService= new UserService();
		    boolean b=userService.alterGrade(grade,id);
		    if(b){
		    	req.getRequestDispatcher("systemset/altergradeOk.jsp").forward(req, resp);
		    }else{
		    	req.getRequestDispatcher("systemset/altergradeError").forward(req, resp);
		    }
	}

	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		this.doGet(req, resp);
	}
	
}
